package com.gdyd.boot.controller;

import com.gdyd.boot.bean.User;
import com.gdyd.boot.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class UserController {

    @Autowired
    IUserService userService;

    @RequestMapping("/findAllUsers")
    public List<User> user(){
        return userService.findAllUsers();
    }

    @RequestMapping("/findUserById")
    public User findUserById(@RequestParam("id") int id){
        log.info("userId:{}",id);
        return userService.findUserById(id);
    }
}
